package org.demo.filemanager.widget.xml;

import org.boxlayout.gui.BoxLayoutEngine;
import org.boxlayout.gui.VisualElement;
import org.boxlayout.gui.layout.LayoutFactory;
import org.boxlayout.gui.type.ColorEnum;
import org.boxlayout.gui.widget.AbstractUnityWidget;

public class XmlAttributeWidget extends AbstractUnityWidget{
	
	String value;
	
	
	VisualElement valueContainer;
	
	public XmlAttributeWidget(BoxLayoutEngine ble,String attributeName,String attributeValue) {		
		this.ble= ble;
		name = attributeName;
		value = attributeValue;
	}
	
	
	public XmlAttributeWidget initVisual() {
		//System.out.println("FileWidget init begin");
		color = defaultColor;
		
		nameContainer = ble.createElement()
		.setColor(color).setColor2(ColorEnum.LIGHTGRAY)
		.setPadding(0.05f).setText(name)
		.setId(name.hashCode());
		
		valueContainer = ble.createElement()
		.setColor(color).setColor2(ColorEnum.LIGHTGRAY)
		.setPadding(0.05f).setText(value);
		
		visual = ble.createElement().setLayout(LayoutFactory.getInstance().getHorizontalLayout())
		.setPadding(0.00f).setColor(ColorEnum.WHITE).add(nameContainer).add(valueContainer);
		
		return this;
	}
	
	public VisualElement getVisual(){
		return visual;
	}

}